<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="./登录.css">

</head>

<body>
    <div class="login-box">
        <h2></h2>
        <!-- <form> -->
        <div class="login-field">
            <input type="text" name="" required="" class="uu">
            <label>用户名</label>
        </div>
        <div class="login-field">
            <input type="text" name="" required="" class="qq">
            <label>账号</label>
        </div>
        <div class="login-field">
            <input type="password" name="" required="" class="ww">
            <label>密码</label>
        </div>
        <button type="submit" onclick="dl()">登录</button>
        <span>记住密码</span><input type="checkbox" class="rr">
        <!-- </form> -->
    </div>
    <script>
        if (localStorage.getItem('b')) {
            location.assign('./首页.html')
        }
        function dl() {
            var a = document.querySelector('.qq').value
            var b = document.querySelector('.ww').value
            var f = document.querySelector('.uu').value
            var e = localStorage.getItem('用户名')
            var c = localStorage.getItem('账号')
            var d = localStorage.getItem('密码')
            // console.log(a,b,c,d);
            if (a == c && b == d && f == e) {
                // location.assign('./商品首页.html')
                var b = document.querySelector('.rr')
                if (b.checked) {
                    localStorage.setItem('b', true)
                    location.assign('./首页.html')
                } else {
                    location.assign('./首页.html')
                }

            } else {
                alert('账号密码或用户名错误')
            }
        }
    </script>
</body>

</html>